package cn.itcast.test;

import java.util.Arrays;
import java.util.Comparator;

import org.junit.Test;

public class Demo1 {
	public static void main(String[] args) {
		String[] str= {"a","aa","ccc"};
		Arrays.sort(str,compare());
		for (String string : str) {
			System.out.println(string);
		}
	}
	//返回值类型是函数式接口	
	public static Comparator<String> compare(){
		return(String o1,String o2)->{
			return o2.length()-o1.length();
		};
	}
}
